package com.csr;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ResellerInfoActivity extends Activity 
{
	TextView tv_acc_name,tv_IDNumber,tv_billingTemp,tv_Name,tv_salesex,
	tv_phone1,tv_Phone2,tv_imei,tv_altPhone,tv_email,tv_addr1,tv_addr2,tv_areaName,
	 tvZipCode,tvStateName,tvIDProof;;
	ResellerInfo agentInfo=AppData.agentInfo;
	Button btnBack,btnLogout;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.agent_info);
		
		Bundle bundle=getIntent().getExtras(); 
		
		if(!bundle.isEmpty())
		{
			if(bundle.getBoolean("istabactivity"))
			{
				LinearLayout ll=(LinearLayout)findViewById(R.id.headerlayout);
				ll.setVisibility(LinearLayout.GONE);
			}
		}
		
		btnBack=(Button)findViewById(R.id.btnPrevious);
        btnLogout=(Button)findViewById(R.id.btnLogout);
		tv_acc_name=(TextView)findViewById(R.id.tv_acc_name_agent);
     // tv_balance=(TextView)findViewById(R.id.tv_acc_balance_agent);
        tv_IDNumber=(TextView)findViewById(R.id.tv_acc_idNumber_agent);
        tv_billingTemp=(TextView)findViewById(R.id.tv_acc_billing_temp_agent);
        tv_salesex=(TextView)findViewById(R.id.tv_salesExe_agent);
        tv_Name=(TextView)findViewById(R.id.tv_name_agent);
        tv_phone1=(TextView)findViewById(R.id.tv_acc_phone1_agent);
        tv_Phone2=(TextView)findViewById(R.id.tv_acc_phone2_agent);
        tv_imei=(TextView)findViewById(R.id.tv_imei_agent);
        tv_altPhone=(TextView)findViewById(R.id.tv_acc_altPhone_agent);
        tv_email=(TextView)findViewById(R.id.tv_email_agent);
        tv_addr1=(TextView)findViewById(R.id.tv_addr1_agent);
        tv_addr2=(TextView)findViewById(R.id.tv_addr2_agent);
        tv_areaName=(TextView)findViewById(R.id.tv_areaName_agent);
        tvZipCode=(TextView)findViewById(R.id.tv_zipCode_agent);
        tvIDProof=(TextView)findViewById(R.id.tv_idProof_agent);
        tvStateName=(TextView)findViewById(R.id.tv_stateName_agent);
         
        btnBack.setOnClickListener(new OnClickListener()
 		{
 			
 			public void onClick(View arg0) 
 			{
 				finish();
 			}
 			
 		});
 		
 		btnLogout.setOnClickListener(new OnClickListener()
 		{
 			
 			public void onClick(View v) 
 			{
 				new AlertDialog.Builder(ResellerInfoActivity.this)
 		        .setTitle( "Exit Application" )
 		        .setMessage( "Are you sure you want to Logout?" )
 		        .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
 		        {
 		            public void onClick(DialogInterface arg0, int arg1) 
 		            {
 		                //do stuff onclick of YES
 		            	setResult(2);
 		            	finish();
 		            }

 					public void onClick(View v) 
 					{
 						// TODO Auto-generated method stub
 						
 					}
 		        })
 		        .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener() {
 		            public void onClick(DialogInterface arg0, int arg1)
 		            {
 		                //do stuff onclick of CANCEL
 		            	arg0.dismiss();
 		               
 		            }

 					public void onClick(View v) 
 					{
 						// TODO Auto-generated method stub
 					}
 		        }).show();
 				  		
 			}
 		});
         
		tv_acc_name.append(agentInfo.getAccountName());
		//tv_balance.append(agentInfo.getBalance());
		tv_IDNumber.append(agentInfo.getIDNumber());
		tvIDProof.append(agentInfo.getIDProofType());
		tv_billingTemp.append(agentInfo.getBillingTemplate());
		tv_salesex.append(agentInfo.getSaleExecutive());
		tv_Name.append(agentInfo.getName());
		tv_phone1.append(agentInfo.getPhone1());
		tv_Phone2.append(agentInfo.getPhone2());
		tv_imei.append(agentInfo.getIMEI());
		tv_altPhone.append(agentInfo.getAltPhone());
		tv_email.append(agentInfo.getEmail());
		tv_addr1.append(agentInfo.getAddress1());
		tv_addr2.append(agentInfo.getAddress2());
		tv_areaName.append(agentInfo.getAreaName());
		tvZipCode.append(agentInfo.getAreaZipCode());
		
		tvStateName.append(agentInfo.getStateName());
	}
	
}
